<?php

require_once './include/common.inc.php';

$page_title = 'jans2en furniture - News - News';
$menu_id = 9;
checkLogin();

$three_month = $timestamp+3600*24*90;


// *** page code start ***
$page_url = 'news.php?';
$sql = "SELECT `id` FROM `news` WHERE `publish_flag` = 1 AND `offline` > $timestamp AND `online` < $three_month";
$query = $db->query($sql);
$sql_all_num = $db->num_rows($query);

$ppp = 10;
getMyParam('page');
$page = empty($page) || !ispage($page) ? 1 : $page;
$start_limit = ($page - 1) * $ppp;
if($start_limit > $sql_all_num) {
    $start_limit = 0;
    $page = 1;
}

$page_show = getPhotoPageStr($sql_all_num, $page, $ppp, $page_url, 'news');
// *** page code end ***


$sql = "SELECT `id`, `subject`, `online`, `offline`, `pic` FROM `news` WHERE `publish_flag` = 1 AND `offline` > $timestamp AND `online` < $three_month ORDER BY `online` DESC LIMIT $start_limit, $ppp";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
    $out_ary[] = $rs;
}


require_once PrintEot('header');
require_once PrintEot('news');
require_once PrintEot('footer');

?>